    <%@ include file="../common.jsp" %>
<script type="text/javascript">
	$(document).ready(function(){
		setWorkFlowURL('<c:out value="${flowExecutionUrl}" />');
		createMapUserDialog();
		setDialogDiv('mapUsersDiv');
		$( "#userList" ).selectable();
		$( "#viewGroupList" ).selectable();		
		$( "#printGroupList" ).selectable();	
	});

</script>
<div class="formBlockColor" style="width: 100%; height: 100%;" align="center"> 
	<form:form commandName="userActivityForm" id="userActivity">
		<table class="adminFilterTable" width="70%">
			<tr class="tableChildHeaderColor">
				<td align="center"> MAP USERS </td>
			</tr>
			<tr class="formSpacingRow"><td></td> </tr>
			<tr class="formSpacingRow"><td></td> </tr>
			<tr>
				<td>
					<div align="center">
						<table class="viewDetails" style="width: 80%;" id="userListForMapping">
							<tr class="heading count">
								<th> Users List </th>
								<th> View Group </th>
								<th> Print Group </th>
							</tr>
							<c:forEach var="userMap" items="${userMap}" varStatus="loop">
								<c:set var="tabColor" value="odd"></c:set>
						     	<c:if test="${(loop.index % 2) eq 0}">
						        	<c:set var="tabColor" value="even"></c:set>
						        </c:if>
								<tr class="${tabColor} count" id="user_${userMap.key}">
									<td>${userMap.value}(${userMap.key})</td>
									<td>
										<form:checkbox path="viewGroup" value="${userMap.key}"/>
									</td>
									<td>
										<form:checkbox path="printGroup" value="${userMap.key}"/>
									</td>
								</tr>
							</c:forEach>
						</table>
						<table class="viewDetails" style="width: 80%; border-spacing: 0px;">
							<tr class="odd" style="vertical-align: middle;">
			    	 			<td align="center" colspan="3">
			    	 				<input type="button" class="formButton ui-corner-all" name="Searchuser" value="Search User" onclick="javascript:openSearchUser();">&nbsp;
									<input type="button" class="formButton ui-corner-all" value="Save User Activity" onclick="javascript:saveActivityMapping('userActivity');">
									<input type="button" class="formButton" value="Cancel" onclick="closeCurrentDialog();">
								</td>
			    	 		</tr>
			    	 		<tr class="even">
			    	 			<td>
					    	 		<c:choose>
			     	 				<c:when test="${fn:length(viewMap) gt 0 or fn:length(printMap) gt 0 }">
			     	 				<table>
				     	 				<tr>
						      	 			<td class="formLabel">
						      	 				Remarks:
						      	 			</td>
						      	 			<td class="spacingColumnWidthLess"></td>
						      	 			<td class="formField">
						      	 				<textarea rows="2" cols="40" name="remarks" id="remarks" ></textarea>
						      	 			</td>
						      	 			<td class="spacingColumnWidthMedium"></td>
						      	 			<td align="left">
						      	 				<input type="button" class="formButton ui-corner-all" value="Approved and Archived" 
						      	 					onclick="javascript:approveOrRejectDocument('userActivity','finalApproval')">
						      	 			</td>
						      	 		</tr>
						      	 		<tr>
						      	 			<td colspan="2"> </td>
						      	 			<td>
						      	 				<form:errors path="remarks" cssClass="errorMsg"></form:errors>
						      	 			</td>
						      	 		</tr>
						      	 	</table>
			     	 				</c:when>
			     	 				<c:otherwise>
			     	 					<input type="hidden" name="remarks" value="remarks">
			     	 				</c:otherwise>
			     	 				</c:choose>
			     	 			</td>
			     	 		</tr>
						</table>
					</div>
				</td>
			</tr>
			<tr class="formSpacingRow"><td></td> </tr>
			<tr class="formSpacingRow"><td></td> </tr>
		</table>
		
		<br></br>
		
		<input type="hidden" id="docId" name="docId" value="${docId}">
		<input type="hidden" id="currentWfId" name="currentWfId" value="${currentWfId}">
		
		<c:forEach var="printMap" items="${printMap}">
	     	<input type="hidden" name="oldPrintGroup" value="${printMap.key}"></input>
	    </c:forEach>
		<c:forEach var="viewMap" items="${viewMap}">
	     	<input type="hidden" name="oldViewGroup" value="${viewMap.key}"></input>
	    </c:forEach>
	</form:form>
</div>